// pages/snows/snows.js
var i = 0;
Page({
 
  /**
   * 页面的初始数据
   */
  data: {
    snows: [],
    animation: [],
    dateTime: "",
    movie_name:"",
    movie_time:"",
    movie_category:"",
    movie_cinema:"",
    totalMoney:0,
    people_num:0,
    // seat:[]
  },
 
  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    let pages  = getCurrentPages();
    let currentPage = pages[pages.length-1] ;
    let options = currentPage.options ;
    this.setData({
      movie_name:options.movie_name,
      movie_time:options.movie_time,
      movie_category:options.movie_category,
      totalMoney:options.totalMoney,
      people_num:options.totalMoney/30,
      movie_cinema:options.movie_cinema
      //seat:options.seat,
    })
  },
 
  /**
   * 生命周期函数--监听页面隐藏
   */
 
  /**
   * 生命周期函数--监听页面卸载
   */
  initSnow: function () {
    setTimeout(function () {
      let animation = wx.createAnimation({})
      animation.translateY(804).opacity(1).step({
        duration: 4000
      })
      animation.translateY(0).opacity(1).step({
        duration: 0
      })
      this.setData({
        ['snows[' + i + ']']: Math.floor(Math.random() * 700),
        ['animation[' + i + ']']: animation.export()
      })
      i++;
      if (i == 50)
        i = 0
    }.bind(this), 500)
    var dateTime = setTimeout(function () {
      this.initSnow()
    }.bind(this), 100)
    this.setData({
      dateTime,
    })
  },
 
})